package service

import (
	"bms/dao"
	"bms/model"
)

func GetBorrowByUserId(userId int64) (*model.Borrow, error) {
	borrow, err := dao.GetBorrowByUserId(userId)
	if err != nil {
		return nil, err
	}
	return borrow, nil
}

func SaveBorrow(borrow *model.Borrow) {
	dao.SaveBorrow(borrow)
}

func UpdateBorrowNums(borrow *model.Borrow) error {
	err := dao.UpdateBorrowNums(borrow)
	if err != nil {
		return err
	}
	return nil
}

func GetBorrow() []*model.Borrow {
	borrows := dao.GetBorrow()
	return borrows
}
